 |
|
 |
Subject: Link onclick triggers on page load... |
 |
 |
 |
Product Area: Domino Server |
 |
Technical Area: Functionality |
 |
Platform: Windows XP client |
 |
Release: 8.5.1 |
 |
Reproducible: Always |
 |
 |
 |
 |
- I have a custom control (CC) that presents a navigator, and one of the things it does is render a list of links to switch views using a document-based repeat control, so the Views and their "names" in the navigator have maximum flexibility. This worked fine when the links specified a simple action to load a XPage with a parameter.
- I converted it to use sessionScope data that's built by another CC, to resolve a timing issue. This also works perfectly, in that the links are generated and function as long as I use a simple action.
- But each link needs to update a sessionScope variable to cache data the link it clicked, now, so I changed it to use the onClick event to run some JS instead of using a simple action.
<xp:link escape="true" text="#{javascript:sessionScope.viewLinks.get(aView);}">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[#{javascript:
sessionScope.viewBy=""+aView;
sessionScope.viewName=""+sessionScope.viewLinks.get(aView);
context.redirectToPage(context.getUrl().getAddress());
}]]></xp:this.script>
</xp:eventHandler></xp:link>
- The problem is this onClick JS runs at page load. The last line the onClick executes is a context.redirectToPage, which simply reloads the page it's already on, using the newly updated sessionScope values. With this script in place FireFox says there's an endless redirection loop. If I take this onClick out, that goes away, but so does the functionality.
- If comment out the redirect, Domino generates a whole pile of JS functions (in firebug), one for each onClick, but they do not contain the script in the tags, they contain the output of the script in the tags.
- I thought perhaps this needed to use an <xp:this.action> tag, but when I edit this in the event tab, it puts <xp:this.script> in there, so I assume that's correct. (grin)
- Any idea what's going on here? Thanks for your time.
 
Feedback number DGIE7X8HT4 created by ~Holly Zekhipisonnivu on 10/27/2009

Status: Closed
Comments:

Link onclick triggers on page load.... (~James Brewever... 27.Oct.09)
. . SOLVED: It's the automagic? (~James Brewever... 27.Oct.09) |
|  |
|